{% extends "base.html" %}

{% block content %}
	<div class="page-header">
		<h1>account</h1>
	</div>

	<div class="row">
		<div class="span12">
			<table class="table">
				<tr><td>name</td><td>{{ u.name }}</td></tr>
				<tr><td>login with</td><td>{{ u.sources|join(", ") }}</td></tr>
				<tr><td>user since</td><td>{{ u.register_date|sdate }}</td></tr>
				<tr><td>total upload size</td><td>{{ u.allowed_data|filesizeformat }}</td></tr>
				<tr><td>used upload size</td><td>{{ u.used_data|filesizeformat }}</td></tr>
				{% if u.can_upload %}<tr><td>remaining upload size</td><td>{{ u.bytes_remaining|filesizeformat }}</td></tr>{% endif %}
				<tr>
					<td>avatar</td>
					<td>
						<img src="{{ u.gravatar(50) }}" alt="{{ u.name }}">
						<p>Change your avatar at <a href="http://gravatar.com/emails">gravatar.com</a>
						<br><small>
							{% if u.email %}
								We're using {{ u.email }}
							{% else %}
								No email address, so no avatar
							{% endif %}
						</small>
						</p>
					</td>
				</tr>
			</table>
		</div>
	</div>

	<div class="row">
		<div class="span12">
			<h3>settings</h3>
			<form class="form-horizontal" method="POST">
				<fieldset>
					<div class="control-group">
						<label class="control-label" for="email">email</label>
						<div class="controls">
							<input id="email" name="email" type="text" value="{{ u.email|default("", true) }}" />
						</div>
					</div>
					<div class="form-actions">
						<input type="submit" class="btn btn-primary" name="settings" value="Save">
					</div>
				</fieldset>
			</form>
		</div>
	</div>

	<div class="row">
		<div class="span12">
			<h3>social media <small>when you save journal entries, get a small message automatically written</small></h3>
			{% for network, values in social.items() %}
			<div class="row">
				<div class="span2">
					{{ network }}
				</div>
				<div class="span2">
					<span class="label label-{{ values.label_class }}">{{ values.label_text }}</span>
				</div>
				<div class="span2">
					<a href="{{ values.auth_url }}" class="btn">{{ values.auth_text }}</a>
				</div>
				<div class="span2">
					<a href="{{ values.enable_url }}" class="btn {{ values.enable_class }}">{{ values.enable_text }}</a>
				</div>
			</div>
			{% endfor %}
		</div>
	</div>

	<div class="row">
		<div class="span12">
			<h3>backup <small>automatically back up your journal entries every time you save (but no images yet)</small></h3>
				{% for network, values in backup.items() %}
			<div class="row">
				<div class="span2">
					{{ network }}
				</div>
				<div class="span2">
					<span class="label label-{{ values.label_class }}">{{ values.label_text }}</span>
				</div>
				<div class="span2">
					<a href="{{ values.auth_url }}" class="btn">{{ values.auth_text }}</a>
				</div>
				<div class="span2">
					<a href="{{ values.enable_url }}" class="btn {{ values.enable_class }}">{{ values.enable_text }}</a>
				</div>
			</div>
			{% endfor %}
		</div>
	</div>

{% endblock %}
